<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 编写一个函数，计算任意数字的和、差、积、商
        要求：使用传参的形式
        
    -->
    <script>
        function fn() {
            var product = 1
            var merchant=1
            var sum = 0
            var difference=0
            for(var i=0;i<arguments.length;i++){
                product*=arguments[i]   //求积
                merchant=arguments[i]/merchant  //求商
                sum+=arguments[i]  //求和
                difference=arguments[i]-difference  //求差

            }
            console.log('任意数字的积'+product);
            console.log('任意数字的商'+merchant);
            console.log('任意数字的和'+sum);
            console.log('任意数字的差'+difference);
            
        }
        fn(2,4)

    </script>
</body>
</html>